#region

using System;
using ThuySan.Bussiness;

#endregion

namespace ThuySan.Models
{
    [Serializable]
    public partial class ProductTagModel
    {
        #region Constructor

        public ProductTagModel()
        {
        }

        public ProductTagModel(ProductTag value)
        {
            ProductTagId = value.ProductTagId;
            ProductId = value.ProductId;
            TagId = value.TagId;
        }

        #endregion

        #region Fields

        private Int32? _ProductId;

        private Int32 _ProductTagId;

        private Int32? _TagId;

        #endregion

        #region Properties

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32 ProductTagId
        {
            get { return _ProductTagId; }
            set { _ProductTagId = value; }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32? ProductId
        {
            get { return _ProductId; }
            set { _ProductId = value; }
        }

        //[NotChanged]
        //[Required(ErrorMessage = "Value is required")]
        //[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
        //[StringLength(0)]
        //[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public Int32? TagId
        {
            get { return _TagId; }
            set { _TagId = value; }
        }

        #endregion

        #region Operators

        public void Update(ProductTag value)
        {
            value.ProductTagId = ProductTagId;
            value.ProductId = ProductId;
            value.TagId = TagId;
        }

        public static implicit operator ProductTagModel(ProductTag obj)
        {
            return new ProductTagModel(obj);
        }

        public static implicit operator ProductTag(ProductTagModel obj)
        {
            ProductTag value = new ProductTag();
            obj.Update(value);
            return value;
        }

        #endregion
    }
}
